/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#ifndef __UMC_AVS_DEC_FUSION_CORE_H
#define __UMC_AVS_DEC_FUSION_CORE_H

#include "umc_avs_fusion_core.h"

namespace UMC
{

// forward declaration of used types
class MediaData;
class BaseCodecParams;
class AVSProcessingUnit;
class AVSFrame;
class AVSSlice;
class AVSMemory;

class AVSDecFusionCore : public AVSFusionCore
{
public:
    // Default constructor
    AVSDecFusionCore(void);
    // Destructor
    virtual
    ~AVSDecFusionCore(void);

    // Initialize the core
    virtual
    Status Init(Ipp32u numThreads, BaseCodecParams *pParams);
    // Add a piece of source data to the core
    virtual
    Status LoadSource(MediaData *pSrc);
    // Set destination fideo frame
    virtual
    Status SetDestination(MediaData *pDst);

protected:
    // Release the object
    Status Release(void);

    // Load single NAL unit into the core
    Status LoadNALUnit(const Ipp8u *pbSrc, size_t srcSize, Ipp64f dNALTime);

    // Parse a sequence header
    void ParseSequenceHeader(const Ipp8u *pbSrc, size_t srcSize);
    // Parse a picture header
    void ParsePictureHeader(const Ipp8u *pbSrc, size_t srcSize);
    // Add a slice to being collected picture
    Status AddSliceToPicture(const Ipp8u *pbSrc, size_t srcSize);
    // Finalize the current being collected picture
    Status FinalizePicture(void);

    // Initialize the frame
    virtual
    Status InitializeFrame(AVSFrame *pFrame);

    //
    // these members could be accessed without synchronization
    //

    Ipp32s m_prevSliceStartCode;                                // (Ipp32u) start code of the previously collected slice
};

} // namespace UMC

#endif // __UMC_AVS_DEC_FUSION_CORE_H
